home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
xmm12.zip
/
XMM.ASM
< prev
next >
Wrap
Assembly Source File
|
1992-07-05
|
60KB
|
1,555 lines
;--------------------------------------------------------------------------
; MODULE : XMM INITIAL : 19891127 v 1.00
; AUTHOR : Jeroen W. Pluimers UPDATE : 19920705 v 1.20
;
; DESCRIPTION : eXtended Memory Manager
;
; HISTORY : 19891127 - 1.00 - jwp
;
; initial translation from XMS 2.0 specification
;
; 19909322 - 1.11 - jwp
;
; final XMS 2.0 implementation
;
; 19920705 - 1.20 - jwp
;
; incorporation of XMS 3.0 specification
;
; incorporation of XMS 3.0 specification
; compiled for Turbo Pascal 6.0
; documentation fixup for XMS 3.0
;
; COMPUTER : NEAT-AT, ERC 386/25
; COMPILER : TASM 1.0, TASM 2.01
; LINKER : TURBO PASCAL 5.0, 5.5 and 6.0
;
; COPYRIGHT : (c) 1989-1992 Pluimers Software Ontwikkeling.
;--------------------------------------------------------------------------
Ideal
Masm51
%title "XMM - eXtended Memory Manager"
%pagesize 70,132
Model TPascal
DataSeg
;----------------------------------------------------------------------------
; there is nothing in the data segment.
;----------------------------------------------------------------------------
CodeSeg
;----------------------------------------------------------------------------
; Macro to convert from XMS success/fail to
; a form more acceptable for TURBO PASCAL. IE.
;
; AX = 1 becomes AL = 0
; AX <> 1 becomes AL = BL
;----------------------------------------------------------------------------
Macro SuccessFail
Local Success
dec ax
jz Success
mov al, bl
Success:
EndM
;----------------------------------------------------------------------------
; Initialised data must reside in the code segment.
;----------------------------------------------------------------------------
XMM_Initialised dw 0
; XMM_Control points to a routine that returns XMMNotInitialised (80h)
; for each XMM call until XMMInstalled is called.
label XMM_Control DWord
dw OFFSET XMM_NotInitialised
dw Code
;---------------------------------------------------------------------------
; ROUTINE : XMM_NotInitialised
;
; DESCRIPTION : Routine called for each XMM function call, when the XMM
; is not initialised with a call to XMMInstalled.
;
; RETURNS : XMMNotInitialised.
;---------------------------------------------------------------------------}
Proc XMM_NotInitialised FAR
xor ax, ax ; Immediate failure
mov bl, 80h ; Not Implemented
ret
EndP
;---------------------------------------------------------------------------
; ROUTINE : XMMInstalled
;
; DESCRIPTION : THIS ROUTINE MUST BE CALLED BEFORE ANY OTHER ROUTINE
; OR ALL THE OTHER ROUTINES WILL FAIL WITH ERROR CODE $80.
;
; RETURNS : False - No XMM driver found.
; True - An XMM driver has been found.
;
; POST : Internal pointer to XMM driver is established.
;
; PASCAL : Function XMMInstalled : Boolean;
;---------------------------------------------------------------------------
Proc XMMInstalled FAR
Public XMMInstalled
cmp [XMM_Initialised], 0
jne @@Already_Initialised
mov ax, 4300h ; Test for XMM
int 2fh
cmp al, 80h
jne @@NoDriver
mov ax, 4310h ; Get Control Function
int 2fh
mov [word ptr cs:XMM_Control], bx
mov [word ptr cs:XMM_Control+2], es
inc [XMM_Initialised]
@@NoDriver:
@@Already_Initialised:
mov ax, [XMM_Initialised]
EndP
;---------------------------------------------------------------------------
; ROUTINE : XMMVersion
;
; DESCRIPTION : Get version numbers. Both the XMS version number and the
; driver internal revision number are encoded as follows :
; Low byte = minor part.
; High byte = major part.
; e.g. XMSversion $0277 would mean version 2.77.
; The HMAAvailable indicates the existence of the HMA (not
; its availability) and is intended mainly for installation
; programs.
;
; OUT : XMSversion - XMS version number.
; XMSrevision - Driver internal revision number.
; HMAAvailable - False - no HMA detected.
; True - HMA has been detected.
;
; RETURNS : XMMNotImplemented - XMMInstalled has not been called.
; XMMOk - Always if XMMInstalled has been called.
;
; PRE : XMMInstalled must have been called first.
;
; PASCAL : Function XMMVersion(Var XMSversion,
; XMSrevision : Word;
; Var HMAAvailable : Boolean) : Byte;
;
; XMS : ARGS: AH = 00h
; RETS: AX = XMS version number (BCD encoded)
; BX = Driver internal revision number.
; DX = 0001h if the HMA exists, 0000h otherwise.
; ERRS: None.
;---------------------------------------------------------------------------}
Proc XMMVersion FAR XMSVersion : DWord, \
Revision : DWord, \
HMAAvailable : DWord
Public XMMVersion
xor ah,ah ; Function 0
call [XMM_Control]
les di,[XMSVersion]
mov [Word Ptr es:di],ax
les di,[Revision]
mov [Word Ptr es:di],bx
les di,[HMAAvailable]
mov [Word Ptr es:di],dx
xor al,al ; return XMMOk
ret
EndP
;---------------------------------------------------------------------------
; ROUTINE : XMMRequestHMA
;
; DESCRIPTION : Attempts to reserve the whole 64K-16 byte high memory
; area for the caller.
; If the HMA is currently unused, the caller's size
; parameter is compared to the /HMAMIN= parameter on
; the driver's command line.
; If the value passed by the caller is greater than or
; equal to the amount specified by the driver's
; parameter, the request succeeds.
; This provides the ability to ensure that programs
; which use the HMA efficiently have priority over
; those which do not.
; NOTE: See the sections "Prioritizing HMA Usage" and
; "High Memory Area Restrictions" in the
; documentation for more information.
;
; IN : SpaceNeeded - Number of bytes in the HMA needed by caller.
; It is recommended that if the caller is
; an application program this value is
; set to 65535 and if the caller is a TSR
; the real number of bytes is used.
;
; RETURNS : XMMOk - the HMA is assigned to the caller.
; XMMNotImplemented - the function is not implemented.
; XMMVDiskFound - a VDISK device is detected.
; XMMHMANotExist - the HMA does not exist.
; XMMHAMInUse - the HMA is already in use.
; XMMHAMMinSize - SpaceNeeded is less than the /HMAMIN=
; env